package com.s64.mq;

import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * 消息的消费者，根据配置的路由Key从指定的exchange中获取消息
 */
@Component
public class OrderConsumer {

    @RabbitListener(queues = "s64.queue.order1")
    public void receive1(Order order) {
        System.out.println("s64.queue.order1收到消息:" + order.getOrderNo());
        System.out.println("=====保存订单到数据库成功=====");
    }

    @RabbitListener(queues = "s64.queue.order2")
    public void receive2(Order order) {
        System.out.println("s64.queue.order2收到消息:" + order.getOrderNo());
        System.out.println("=====从数据库删除订单成功=====");
    }
}
